package cn.itcast.day1;


public class EnumTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		WeekDay1 weekDay = WeekDay1.MON;
		System.out.println(weekDay.nextDay());
		System.out.println("--------------------------------------");
		WeekDay weekDay2 = WeekDay.FRI;
		System.out.println(weekDay2);
		System.out.println(weekDay2.name());
		System.out.println(weekDay2.ordinal());
		System.out.println(WeekDay.valueOf("SUN").toString());
		System.out.println(WeekDay.values().length);
		
		System.out.println("--------------------------------------");
		TrafficLamp lamp = TrafficLamp.RED;
		TrafficLamp tl =lamp.nextLamp();
		System.out.println(tl+" : "+tl.time);
	}

	public enum WeekDay {
		SUN(1), MON(), TUE, WED, THI, FRI, SAT;
		private WeekDay() {
			System.out.println("first");
		}

		private WeekDay(int day) {
			System.out.println("second");
		}
	}

	public enum WeekDay3 {
		SUN, MON, TUE, WED, THI, FRI, SAT
	}

	public enum TrafficLamp {
		RED(30) {
			public TrafficLamp nextLamp() {
				return GREEN;
			}
		},
		GREEN(45) {
			public TrafficLamp nextLamp() {
				return YELLOW;
			}
		},
		YELLOW(5) {
			public TrafficLamp nextLamp() {
				return RED;
			}
		};
		public abstract TrafficLamp nextLamp();

		public int time;

		private TrafficLamp(int time) {
			this.time = time;
		}
	}

}
